As of version 1.6.0.2 of Tiny Hexer, you can use custom dialogs in scripts to interact with the user. This functionality is stored in the plugin plugin_scriptgui.ths. The gui related constants are defined in the include file gui.mps.
|
Note: At the time being, documentation for the GUI functionality of Tiny Hexer Script is "rough-and-ready". It will be improved in a later release of this help file (if and when time permits...)
|
|
|
Use the GUIADDITEM() function
to add an item to the ITEMS list of a
'COMBOBOX', 'LISTBOX', 'MEMO' or
'RADIOGROUP' control.
Parameters:
Return value:
This function returns a (pointless) numeric value different from 0. If an
error occurs while the function is executed, the script is terminated
unless the ERRORHANDLER
command is used.
|
Use the GUICREATE() function to
create a dialog or a control on a dialog.
Parameters:
Return value:
This function returns a (pointless) numeric value different from 0. If an
error occurs while the function is executed, the script is terminated
unless the ERRORHANDLER
command is used.
Notes:
|
Use the GUIDELETEITEM()
function to remove an item from the ITEMS list of
a 'COMBOBOX', 'LISTBOX', 'MEMO' or
'RADIOGROUP' control.
Parameters:
Return value:
This function returns a (pointless) numeric value different from 0. If an
error occurs while the function is executed, the script is terminated
unless the ERRORHANDLER
command is used.
|
Use the GUIDESTROY() function
to remove a previously created dialog or control chain permanently from
memory.
Parameters:
Return value:
This function returns a (pointless) numeric value different from 0. If an
error occurs while the function is executed, the script is terminated
unless the ERRORHANDLER
command is used.
Notes:
|
Use the GUIEXISTS() function to
determine whether a control or dialog has already been created.
Parameters:
Return value:
This function returns 0 if the control does not exist and a
value other than 0 if the control exists.
|
Use the GUIGETITEM() function
to retrieve a value of the ITEMS list of a
'COMBOBOX', 'LISTBOX', 'MEMO' or
'RADIOGROUP' control.
Parameters:
Return value:
This function returns the textual value of the entry in the control's ITEMS
list at the specified index.
|
Use the GUIGETITEMCOUNT()
function to retrieve the number of entries of the ITEMS list of a 'COMBOBOX', 'LISTBOX',
'MEMO' or 'RADIOGROUP' control.
Parameters:
Return value:
This function returns the number of entries in the control's ITEMS
list.
|
Use the GUIGETPROP() function
to retrieve the value of a control
property.
Parameters:
Return value:
This function returns the value (either a numeric or textual value) of the
queried control property.
|
Use the GUIITEMSELECTED()
function to check whether an item in a 'LISTBOX' control is currently selected.
Parameters:
Return value:
If the item at INDEX is currently selected, the function returns a value
different from 0, otherwise 0 is returned. If an error occurs while the
function is executed, the script is terminated unless the ERRORHANDLER command is used.
Notes:
|
Call the GUIPROCESSMESSAGES()
function periodically to let the gui engine process user input in non-modal
dialogs.
Parameters:
This function has no parameters.
Return value:
This function returns a (pointless) numeric value different from 0.
Notes:
|
Use the GUISELECTITEM()
function to change the selected state of an item in a 'LISTBOX' control.
Parameters:
Return value:
This function returns a (pointless) numeric value different from 0. If an
error occurs while the function is executed, the script is terminated
unless the ERRORHANDLER
command is used.
Notes:
|
Use the GUISETITEM() function
to change the value of an entry in the ITEMS list
of a 'COMBOBOX', 'LISTBOX', 'MEMO' or
'RADIOGROUP' control.
Parameters:
Return value:
This function returns a (pointless) numeric value different from 0. If an
error occurs while the function is executed, the script is terminated
unless the ERRORHANDLER
command is used.
|
Use the GUISETPROP() function
to change the value of a control property.
Parameters:
Return value:
This function returns a (pointless) numeric value different from 0. If an
error occurs while the function is executed, the script is terminated
unless the ERRORHANDLER
command is used.
|
Use the GUISHOWMODAL() function
to display a FORM modally.
Parameters:
Return value:
This function returns the numeric value of the FORM'S MODALRESULT control
property.
Notes:
|
|
BUTTON: a push-button which displays a text and can be clicked by the user. |
Special properties: CANCEL, CAPTION, DEFAULT, MODALRESULT
|
CHECKBOX: a control which displays a text and lets the user toggle its state |
Special properties: ALLOWGRAYED, CAPTION, CHECKED, STATE
|
COMBOBOX: a combination of an EDIT control and a LISTBOX control. |
Special properties: STYLE (see also special properties of EDIT,
LISTBOX)
Special event handlers: ONSELECT (see also special event handlers of
EDIT)
|
EDIT: lets the user enter text via the keyboard |
Special properties: AUTOSELECT, AUTOSIZE,
HIDESELECTION, MAXLENGTH, PASSWORDCHAR, READONLY, SELLENGTH,
SELSTART, SELTEXT,
TEXT
Special event handlers: ONCHANGE
|
FORM: a root control (i.e. a dialog) that contains other controls. |
Special properties: BORDERICONS, BORDERSTYLE, CAPTION,
CLIENTHEIGHT, CLIENTWIDTH, MODALRESULT, POSITION,
WINDOWSTATE
Special event handlers: ONCLOSE, ONCREATE, ONDESTROY, ONHIDE, ONSHOW
|
GROUPBOX: a control that can contain other controls to group them. |
|
LISTBOX: a control which contains a list of entries that can be clicked (and thus selected) by the user. |
Special properties: ITEMINDEX, ITEMS, MULTISELECT, SELCOUNT
|
MEMO: lets the user enter text via the keyboard (similar to the EDIT control, but MEMO can handle multiple lines via its ITEMS property) |
Special properties: HIDESELECTION, ITEMS,
MAXLENGTH, READONLY, SCROLLBARS,
SELLENGTH, SELSTART, SELTEXT,
TEXT
Special event handlers: ONCHANGE
|
RADIOBUTTON: a control which displays a text and lets the user toggle its state. The RADIOBUTTON control is similar to the CHECKBOX control, but just one radio button in a group can be checked at once. All radio buttons which share the same parent control (a FORM or GROUPBOX control) belong to the same group. |
Special properties: CAPTION, CHECKED
|
RADIOGROUP: a combination of a GROUPBOX control and a group of two ore more RADIOBUTTON controls. The RADIOBUTTONs on this control are managed via the ITEMS and ITEMINDEX properties. |
Special properties: CAPTION, COLUMNS, ITEMINDEX, ITEMS
|
STATIC: a control showing a static text. |
Special properties: AUTOSIZE, CAPTION, LAYOUT, TRANSPARENT
|
Each GUI control has various properties which affect the control's behaviour and appearance. Some of them are common to all control types (like LEFT, RIGHT, WIDHT, HEIGHT and VISIBLE), other properties only apply to certain control types (like MODALRESULT, which only applies to the control types FORM and BUTTON). Use the GUISETPROP() or GUIGETPROP() functions to change or retrieve a control property, respectively.
|
ALIGN (BYTE): Tells the gui engine how the control is aligned regarding the dimensions of the parent control. Possible values:
Applies to: GROUPBOX, LISTBOX, MEMO, RADIOGROUP, STATIC
COLOR (LONGWORD): Color of the control. A color value
consists of three byte values: RED, GREEN, BLUE. To set a new color, use
the formula (BLUE << 16) OR (GREEN << 8) OR RED
Applies to: All control types but BUTTON
ENABLED (BYTE): 0: The control is not enabled (the
user cannot interact with the control), 1: the control is
enabled
Applies to: All control types
FOCUSED (BYTE): 0: The control is not currently
focused (i.e. it isn't the control that the user has activated), 1:
the control is focused
Applies to: All control types but STATIC
FONTCOLOR (LONGWORD): Color of the control's font. A color
value consists of three byte values: RED, GREEN, BLUE. To set a new font
color, use the formula (BLUE << 16) OR (GREEN << 8) OR
RED
Applies to: All control types
FONTHEIGHT (SIGQWORD): Height of the control's font in
pixels
Applies to: All control types
FONTNAME (TEXT): Name of the control's font (e.g. "Arial",
"Courier New")
Applies to: All control types
FONTSTYLE (WORD): Style of the control's font. The property can be set to a combination (use the OR operator) of the following values:
Applies to: All control types
HEIGHT (LONGWORD): Overall height of the control
Applies to: All control types
KEY
(WORD): Current virtual key code, only valid in the ONKEY event handler.
Applies to: All control types but STATIC
LEFT
(SIGQWORD): Left position of the control relative to its parent's
position
Applies to: All control types
PARENTCOLOR (BYTE): If set to 1, the COLOR property
is reset to use the value of the parent control's COLOR property
Applies to: All control types but BUTTON
PARENTFONT (BYTE): If set to 1, the FONT...
properties are reset to the values of the parent control's FONT...
properties
Applies to: All control types
SHIFT (WORD): Current state of special keys and mouse buttons, only valid in the ONKEY event handler. This value can contain a combination of the following flags:
Applies to: All control types but STATIC
TAG
(SIGQWORD, but only 32 bits wide): Arbitrary numeric value attached to a
control
Applies to: All control types
TOP
(SIGQWORD): Top position of the control relative to its parent's
position
Applies to: All control types
VISIBLE (BYTE): 0: The control is not visible,
1: the control is visible
Applies to: All control types
WIDTH (LONGWORD): Overall width of the control
Applies to: All control types
WORDWRAP (BYTE): 0: The control does not
automatically wrap its text at the right border, 1: the control
automatically wraps its text at the right border
Applies to: BUTTON, CHECKBOX, MEMO, RADIOBUTTON,
STATIC
|
ALLOWGRAYED (BYTE): 0: The CHECKBOX toggles between
unchecked and checked state, 1: the CHECKBOX toggles between
unchecked, checked and grayed state (three-state checkbox)
Applies to: CHECKBOX
AUTOSELECT (BYTE): 0: The text of the EDIT control
is not automatically selected when it is focused, 1: the text is
automatically selected when the EDIT control gets focused
Applies to: EDIT
AUTOSIZE (BYTE): 0: The control's height is fixed,
1: the control's height is automatically adjusted depending on the
height of the text/caption's font
Applies to: EDIT, STATIC
BORDERICONS (WORD): Icons to display on the FORM's title bar. The property can be set to a combination (use the OR operator) of the following values:
Applies to: FORM
BORDERSTYLE (WORD): Style of the FORM's border frame. The property can be set to one of the following values:
Applies to: FORM
CANCEL (BYTE): 0: The BUTTON does not catch the ESC
key, 1: the BUTTON catches the ESC key.
Applies to: BUTTON
CAPTION (TEXT): Static text of the control (see also
TEXT)
Applies to: BUTTON, CHECKBOX, GROUPBOX, FORM, RADIOBUTTON,
RADIOGROUP, STATIC
CHECKED (BYTE): 0: The control is in unchecked
state, 1: the control is in checked state. (If a CHECKBOX is in
ALLOWGRAYED (three-state) mode, use the
STATE property)
Applies to: CHECKBOX, RADIOBUTTON
CLIENTHEIGHT (LONGWORD): Height of the FORM without title
bar, scrollbars and border frame.
Applies to: FORM
CLIENTWIDTH (LONGWORD): Width of the FORM without
scrollbars and border frame.
Applies to: FORM
COLUMNS (BYTE): Number of columns of RADIOBUTTON controls
on the RADIOGROUP.
Applies to: RADIOGROUP
DEFAULT (BYTE): 0: The BUTTON does not catch the
ENTER key, 1: the BUTTON catches the ENTER key.
Applies to: BUTTON
HIDESELECTION (BYTE): 0: The control's selection is
visible when the control does not have the focus, 1: the selection
is marked only if the control is focused.
Applies to: EDIT, MEMO
ITEMINDEX (SIGQWORD): The control's currently selected
item, -1 if no item is selected
Applies to: COMBOBOX, LISTBOX, RADIOGROUP
ITEMS (TEXT): The list of all control's items, separated
by NEWLINE characters. To modify single items, use the functions GUIADDITEM(), GUIDELETEITEM(), GUIGETITEM(), GUIGETITEMCOUNT(), GUISETITEM().
Applies to: COMBOBOX, LISTBOX, MEMO, RADIOGROUP
LAYOUT (WORD): Layout of the STATIC's text. The property can be set to one of the following values:
Applies to: STATIC
MAXLENGTH (LONGWORD): Maximum number of characters the
user can type, if set to 0, the max. text size depends on the operating
system.
Applies to: COMBOBOX, EDIT, MEMO
MODALRESULT (WORD): If a FORM is displayed using the GUISHOWMODAL() function, it is closed if its MODALRESULT property is set to a value different from 0, and the value of this property is returned as the function result. If a BUTTON control's MODALRESULT is set to a value different from 0, this value is copied to the FORM's MODALRESULT if the button is clicked and thus the form is closed. Common values are (defined in def.mps):
Applies to: BUTTON, FORM
MULTISELECT (BYTE): 0: Only one item of the LISTBOX
control can be selected at a time, 1: multiple items can be selected
at a time. Use the GUISELECTITEM() and
GUIITEMSELECTED() functions to work with
multiple selection LISTBOX controls.
Applies to: LISTBOX
PASSWORDCHAR (CHAR): If this property is set to a value
different from CHAR(0), the text the user types is not visible, all
characters are replaced by the value of this property in the display of the
EDIT control.
Applies to: EDIT
POSITION (WORD): Initial position of the FORM control. Possible values are:
Applies to: FORM
READONLY (BYTE): 0: The user can change the text of
the control using the keyboard, 1: the user cannot change the
control's text.
Applies to: EDIT, MEMO
SCROLLBARS (WORD): Tells the GUI engine which scrollbars the MEMO control should display. Possible values are:
Applies to: MEMO
SELCOUNT (LONGWORD): Number of selected items in a LISTBOX
control in MULTISELECT mode.
Applies to: LISTBOX
SELLENGTH (LONGWORD): Length of the control's editable
text (in characters) currently selected.
Applies to: COMBOBOX, EDIT, MEMO
SELSTART (LONGWORD): Index of the first selected character
of the control's editable text. If SELLENGTH
is 0, the caret position is returned.
Applies to: COMBOBOX, EDIT, MEMO
SELTEXT (TEXT): The control's editable text that is
currently selected. On write access, the current selection is replaced by
the value.
Applies to: COMBOBOX, EDIT, MEMO
STATE (WORD): The CHECKBOX control's current state if it's in ALLOWGRAYED (three-state) mode. Possible values are:
Applies to: CHECKBOX
STYLE (WORD): The COMBOBOX control's style. Possible values are:
Applies to: COMBOBOX
TEXT
(TEXT): Text of the control that can be edited by the user using the
keyboard (see also CAPTION)
Applies to: COMBOBOX, EDIT, MEMO
TRANSPARENT (BYTE): 0: Text and background of the
STATIC control are drawn, 1: Only the STATIC control's text is
drawn.
Applies to: STATIC
WINDOWSTATE (WORD): The FORM control's window state. Possible values are:
Applies to: FORM
|
Each GUI control has various event handlers which can be linked to labels in the script. Then each time the corresponding event is fired, that script label is executed. Each event handling script block must use the RETURN command when finished. To assign a block of script code to an event, use GuiSetProperty(<ControlName>, <EventName>, <LabelName>), e.g. GuiSetProperty("FORM1.EDIT1", "ONCHANGE", "EDITCHANGEHANDLER"). Events are fired if certain actions are performed. They are briefly explained in this topic.
|
ONCLICK: This event is fired when the control has been
clicked.
Applies to: All control types
ONDBLCLICK: This event is fired when the control has been
doubleclicked.
Applies to: All control types but BUTTON, CHECKBOX,
RADIOGROUP
ONENTER: This event is fired when the control is activated
(i.e. gets the focus).
Applies to: All control types but STATIC
ONEXIT: This event is fired when the control is
deactivated (i.e. loses the focus).
Applies to: All control types but STATIC
ONKEY:
This event is fired when the control has the focus and a key has been
pressed. The key being pressed can be retrieved and changed using the
KEY property, the current state of the modifier
keys and the mouse buttons can be retrieved using the SHIFT property.
Applies to: All control types but STATIC
|
ONCHANGE: This event is fired when the control's text has
been changed.
Applies to: COMBOBOX, EDIT, MEMO
ONCLOSE: This event is fired when the FORM is closed (by
setting the MODALRESULT property).
Applies to: FORM
ONCREATE: This event is fired when the FORM is created (by
using the GUICREATE() function).
Applies to: FORM
ONDESTROY: This event is fired when the FORM is destroyed
(by using the GUIDESTROY() function).
Applies to: FORM
ONHIDE: This event is fired when the FORM gets hidden (by
setting the VISIBLE property to
0).
Applies to: FORM
ONSELECT: This event is fired after an item has been
selected from the COMBOBOX control's drop-down list.
Applies to: COMBOBOX
ONSHOW: This event is fired when the FORM gets displayed
(either by using the GUISHOWMODAL() function or
by setting the VISIBLE property to
1).
Applies to: FORM
|